package com.fw.payment.util;

import java.math.BigDecimal;

public class StringUtil {

    public static String getCashFormat(String serviceId, String mcInv) {
	int stringSize = 25;
	String result = serviceId + mcInv;
	if (result.length() < stringSize) {
	    result = serviceId + org.apache.commons.lang.StringUtils.leftPad(mcInv, stringSize - result.length() + mcInv.length(), "0");
	} else {
	    result = result.substring(0, stringSize);
	}
	return result;
    }

    public static BigDecimal stringToBigDecimal(String val) {
	BigDecimal bigDecimal = null;
	if (val != null && val.length() > 0) {
	    val = val.replaceAll(",", "");
	    bigDecimal = new BigDecimal(val);
	}
	return bigDecimal;
    }

}
